package com.example.goodog.adapters;

import java.util.Locale;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.android.wizardpager.AbstractWizardModel;
import com.example.android.wizardpager.AddParkWizardModel;
import com.example.goodog.ComparatorByDistance;
import com.example.goodog.R;
import com.example.goodog.interfaces.IAddWizard;
import com.example.goodog.items.ParkItem;


public class ParkAdapter extends ItemAdapter implements IAddWizard{
	
	
	public ParkAdapter(Context c, int PageNumber) {
		super(c, ParkItem.class.getSimpleName(), R.layout.park_item, PageNumber);
		AddComparator(new ComparatorByDistance(0, 0));
		// TODO Auto-generated constructor stub
	}
	

	
	public View getView(int position, View convertView, ViewGroup parent) {
		View List = super.getView(position, convertView, parent);
		
		ParkItem item = ((ParkItem)items.get(position));
		
		TextView ParkAddressText = (TextView)List.findViewById(R.id.parkAddressTextView);
		ParkAddressText.setText(item.Address);
		
		TextView ParkActiveText = (TextView) List.findViewById(R.id.parkActiveText);
		
		ParkActiveText.setText(Integer.toString(item.Active));
		
				
		ImageView ParkImage = (ImageView) List.findViewById(R.id.parkImage);
		Bitmap bmp = items.get(position).getBitmap();
		if(bmp != null)
		{
			ParkImage.setImageBitmap(bmp);
		}
	
			
		AddButtonsToToolbar(List, item);
		
		return List;
	}	
	
	public String GetTitle()
	{
		Locale l = Locale.getDefault();
		return context.getString(R.string.parks).toUpperCase(l);
	}
	
	@Override
	public AbstractWizardModel getAddWizard(Context c) {
		return new AddParkWizardModel(c);
	}

}
